package com.itheima.d5_resource;

import java.io.*;

/*
     目标：掌握释放资源的方式：try-with-resource
 */
public class Test3 {
    public static void main(String[] args) {
        try (FileInputStream fis = new FileInputStream("E:\\ttt\\a.txt");
             FileOutputStream fos = new FileOutputStream("E:\\ttt\\wss.txt");) {

            int l;
            byte[] bb = new byte[1024];
            while ((l = fis.read(bb)) != -1) {
                System.out.println(l);
                fos.write(bb, 0, l);
            }


        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
